Skip to content

Conversation

@javuto
Copy link
Collaborator

@javuto javuto commented Dec 23, 2025

Adding new tool to test osctrl-api:

tools/api_tester.py

Updated README as well.

@javuto javuto requested a review from Copilot December 23, 2025 22:37
@javuto javuto added osctrl-api osctrl-api related changes 🛠️ tools Tools related issues labels Dec 23, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR replaces the basic api_testing.py script with a more comprehensive API testing tool renamed to api_tester.py. The new tool provides systematic testing of all osctrl-api endpoints with detailed reporting, authentication support, and configurable options.

Key changes:

  • Complete rewrite of the API testing script with enhanced functionality
  • Added support for token-based authentication and login flow
  • Implemented comprehensive test coverage across all API endpoint categories
  • Added colored output, verbose mode, and configurable SSL verification

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.

File Description
tools/api_testing.py Removed old basic API testing script
tools/api_tester.py Added new comprehensive API testing tool with full endpoint coverage and authentication
tools/README.md Updated documentation to reflect new tool name and usage patterns

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

try:
response_json = response.json()
self.log_verbose(f" Response: {json.dumps(response_json, indent=2)}")
except:
Copy link

Copilot AI Dec 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bare except clause catches all exceptions including system exits and keyboard interrupts. Use 'except Exception:' or specify the expected exception type (e.g., 'json.JSONDecodeError').

Suggested change
except:
except (ValueError, json.JSONDecodeError):

Copilot uses AI. Check for mistakes.
try:
error_data = response.json()
self.log(f" Error: {error_data.get('error', 'Unknown error')}", Colors.RED)
except:
Copy link

Copilot AI Dec 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bare except clause catches all exceptions including system exits and keyboard interrupts. Use 'except Exception:' or specify the expected exception type (e.g., 'json.JSONDecodeError').

Suggested change
except:
except ValueError:

Copilot uses AI. Check for mistakes.
error_data = response.json()
error_msg = error_data.get('error', 'Unknown error')
self.log(f"✗ Login failed: {error_msg}", Colors.RED)
except:
Copy link

Copilot AI Dec 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bare except clause catches all exceptions including system exits and keyboard interrupts. Use 'except Exception:' or specify the expected exception type (e.g., 'json.JSONDecodeError').

Copilot uses AI. Check for mistakes.
error_data = response.json()
error_msg = error_data.get('error', 'Bad request')
self.log(f"✗ Login failed: {error_msg}", Colors.RED)
except:
Copy link

Copilot AI Dec 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bare except clause catches all exceptions including system exits and keyboard interrupts. Use 'except Exception:' or specify the expected exception type (e.g., 'json.JSONDecodeError').

Copilot uses AI. Check for mistakes.
error_data = response.json()
error_msg = error_data.get('error', f'HTTP {response.status_code}')
self.log(f"✗ Login failed: {error_msg}", Colors.RED)
except:
Copy link

Copilot AI Dec 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bare except clause catches all exceptions including system exits and keyboard interrupts. Use 'except Exception:' or specify the expected exception type (e.g., 'json.JSONDecodeError').

Copilot uses AI. Check for mistakes.
@javuto javuto merged commit 4044cab into main Dec 23, 2025
54 checks passed
@javuto javuto deleted the api-testing-tool branch December 23, 2025 22:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

osctrl-api osctrl-api related changes 🛠️ tools Tools related issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants